<template>
    <div id="pdfDom1">
      <!-- 孕期营养处方 -->
      <div style="">
        <div style=" width: 100%; background-color:#2ab28b;  text-align: center; margin:auto">
          <div style="font-size: 40px; font-weight: bold; color: #ffffff;padding-top:10px;padding-bottom: 10px;">{{ Titlename }}</div>
          <!-- <span style="font-size: 30px; color: #666666; margin-left: 20px;display: block;">基本信息报告</span> -->
          <!-- <div style="margin-top:30px;font-size: 24px;padding-bottom: 20px;font-weight: bold;color:#333333;">儿童营养风险筛查报告单
          </div> -->
        </div>
      </div>
      <div style="width: 100%; height: 30px; background-color: #2AB28B; margin-top: 10px; display: flex;">
            <div><img src="../assets/img/12.jpg" style="height: 30px" alt="" /></div>
            <div style="font-size: 20px; margin-left: 10px; line-height: 30px; color: #fff;">儿童基本信息</div>
      </div>
          <div
          style="width: 1070px; border-top: 2px solid #09a578; border-right: 2px solid #09a578;  margin-top: 5px;font-size: 14px;"
          v-if="times == 2">
          <div style="display: flex;width: 100%;">
            <div style="width: 100%;display: flex;">
                <div
                style="background-color: #2AB28B; width: 20%;height: 30px;text-align: center;line-height: 30px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
                检测日期</div>
              <div style="width: 80%; height: 30px; border-bottom: 2px solid #09a578; line-height:30px; text-indent: 20px;border-right: 2px solid #09a578;">
                {{ report_time }}
              </div>
            </div>
            <div style="width: 100%;display: flex;">
              <div
              style="background-color: #2AB28B; width: 20%;height: 30px;text-align: center;line-height: 30px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              年龄</div>
            <div style="width: 80%; height: 30px; border-bottom: 2px solid #09a578; line-height: 30px; text-indent: 20px;">
              {{ userinfo.birth }}
            </div>
          </div>

          </div>
          <div style="display: flex">
            <div
              style="background-color: rgb(42, 178, 139); width: 10%;height: 30px;text-align: center;line-height: 30px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              儿童姓名
            </div>
            <div
              style="width: 15%;height: 30px;text-align: center;line-height: 30px;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              {{ contents.username ?? '[]' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%; height: 30px; text-align: center; line-height: 30px; color:#fff; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
              性别
            </div>
            <div
              style="width: 15%; height: 30px; text-align: center;line-height: 30px;border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
              {{ contents.sex == 1 ? '女' : '男' ?? '[]' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139); width: 10%; height: 30px; text-align: center; line-height: 30px; color:#fff; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
              出生日期
            </div>
            <div
              style="width: 15%;height: 30px;text-align: center;line-height: 30px;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              {{ birth ?? '[]' }}
            </div>
            <div
              style=" background-color: rgb(42, 178, 139); width: 10%; height: 30px; text-align: center; line-height: 30px;color:#fff; border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              监护人姓名
            </div>
            <div style="width: 15%;height: 30px;text-align: center;line-height: 30px;border-bottom: 2px solid #09a578;">
              {{ contents.guardian_name ?? '[]' }}
            </div>
          </div>
          <div style="display: flex">
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              监护人手机号
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.guardian_mobile ?? '[]' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              身高
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.height ? contents.height + 'CM' : '' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              体重
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #white; border-bottom: 2px solid #09a578; ">
              {{ contents.weight ? contents.weight + 'KG' : '' }}
            </div>
            <div
              style="width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid white;border-bottom: 2px solid #09a578;">
            </div>
            <div style="width: 15%;height: 30px;text-align: center;line-height: 30px;border-bottom: 2px solid #09a578;">
            </div>
          </div>
        </div>
        <div style="width: 1070px; border-top: 2px solid #09a578; border-right: 2px solid #09a578;  margin-top: 10px"
          v-if="times == 1">
          <div style="display: flex">
            <div
              style="background-color: #2AB28B; width: 9.9%;height: 30px;text-align: center;line-height: 30px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              检测日期</div>
            <div style="width: 90%; height: 30px; border-bottom: 2px solid #09a578; line-height: 30px; text-indent: 20px;">
              {{ report_time }}
            </div>
          </div>
          <div style="display: flex">
            <div
              style="background-color: rgb(42, 178, 139); width: 10%;height: 30px;text-align: center;line-height: 30px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              儿童姓名
            </div>
            <div
              style="width: 15%;height: 30px;text-align: center;line-height: 30px;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              {{ contents.username ?? '[]' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%; height: 30px; text-align: center; line-height: 30px; color:#fff; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
              性别
            </div>
            <div
              style="width: 15%; height: 30px; text-align: center;line-height: 30px;border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
              {{ contents.sex == 1 ? '女' : '男' ?? '[]' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139); width: 10%; height: 30px; text-align: center; line-height: 30px; color:#fff; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
              出生日期
            </div>
            <div
              style="width: 15%;height: 30px;text-align: center;line-height: 30px;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              {{ birth ?? '[]' }}
            </div>
            <div
              style=" background-color: rgb(42, 178, 139); width: 10%; height: 30px; text-align: center; line-height: 30px;color:#fff; border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              监护人姓名
            </div>
            <div style="width: 15%;height: 30px;text-align: center;line-height: 30px;border-bottom: 2px solid #09a578;">
              {{ contents.guardian_name ?? '[]' }}
            </div>
          </div>
          <div style="display: flex">
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              监护人手机号
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.guardian_mobile ?? '[]' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              身高
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.height ? contents.height + 'CM' : '' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              体重
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.weight ? contents.weight + 'KG' : '' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              头围
            </div>
            <div style="width: 15%;height: 30px;text-align: center;line-height: 30px;border-bottom: 2px solid #09a578;">
              {{ contents.touwei ? contents.touwei + 'CM' : '' }}
            </div>
          </div>
          <div style="display: flex">
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              出生身长
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.chushengsg ? contents.chushengsg + 'CM' : '' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              出生体重
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.chushengtz ? contents.chushengtz + 'KG' : '' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              腹围
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.fuwei ? contents.fuwei + 'CM' : '' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              血型
            </div>
            <div style="width: 15%;height: 30px;text-align: center;line-height: 30px;border-bottom: 2px solid #09a578;">
              {{ contents.xuexing_value ? contents.xuexing_value : '' }}
            </div>
          </div>
          <div style="display: flex">
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              民族
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.minzu_value ? contents.minzu_value : '' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              与监护人关系
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.guanxi_value ? contents.guanxi_value : '' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              家长受教育程度
            </div>
            <div
              style=" width: 15%; height: 30px; text-align: center; line-height: 30px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
              {{ contents.jiaoyu_value ? contents.jiaoyu_value : '' }}
            </div>
            <div
              style="background-color: rgb(42, 178, 139);width: 10%;height: 30px;text-align: center; line-height: 30px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
              出生情况
            </div>
            <div style="width: 15%;height: 30px;text-align: center;line-height: 30px;border-bottom: 2px solid #09a578;">
              {{ contents.birthSituation_value ? contents.birthSituation_value : '' }}
            </div>
          </div>
        </div>
        <!-- <div style="" v-if="monthsDifference>=36">
          <div style=" width: 100%; background-color:#2ab28b;  text-align: center; margin:auto">
            <div style="font-size: 40px; font-weight: bold; color: #ffffff;padding-top:20px;">{{ Titlename }}</div>
            <span style="font-size: 30px; color: #666666; margin-left: 20px;display: block;">基本信息报告</span>
            <div
              style="margin-top:30px;font-size: 24px;padding-bottom: 20px;font-weight: bold;padding-top: 20px;color:#333333;">
              儿童体质测评分析报告单</div>
          </div>
        </div> -->
        <!-- 体成分数据分析 -->
        <!-- <div style="width: 100%;height: 30px;background-color: rgb(42, 178, 139);margin-top: 10px;display: flex;" v-if="monthsDifference>=36">
          <div><img src="../assets/img/13.jpg" style="height: 40px" alt="" /></div>
          <div style="font-size: 20px;margin-left: 10px;line-height: 30px;color:#fff;">
            体成分数据分析
          </div>
        </div>
        <ChildViewcomposition v-if="monthsDifference>=36"></ChildViewcomposition> -->

          <!-- 膳食结构分析 -->
          <div
          style="width: 100%;height: 30px;background-color: rgb(42, 178, 139); margin:auto;margin-top: 10px;display: flex;">
          <div><img src="../assets/img/19.jpg" style="height: 30px" alt="" /></div>
          <div style="font-size: 20px;margin-left: 10px;line-height: 30px;color:#fff;">
            膳食结构分析(日均值)
          </div>
        </div>
        <div
        style="width:1071px;margin:10px auto;border:2px solid #09a578;text-align:center;line-height:30px;font-size: 10px;">
        <div style="display:flex;">
          <div class="biao1" style="width:14.5%">膳食结构</div>
  
          <div class="biao7"
            :style="item.product_energy < item.systam_down ? 'color:red' : item.product_energy >= item.systam_down && item.product_energy <= item.systam_up ? 'color:black' : 'color:red'"
            v-for="(item, index) in pagoda" :key="index" style="width:14.5%">{{ item.title == undefined
              ? '' : item.product_energy < item.systam_down ? '▼' + item.title : item.product_energy >= item.systam_down &&
                item.product_energy <= item.systam_up ? '✔' + item.title : '▲' + item.title }} </div>
          </div>
          <div style="display:flex;">
            <div class="biao1" style="width:14.5%">推荐(g)</div>
            <div class="biao7" v-for="(item, index) in pagoda" :key="index" style="width:14.5%">{{
              item.title == undefined ? '' : item.systam_down + '~' + item.systam_up }}</div>
          </div>
          <div style="display:flex;">
            <div class="biao5" style="width:14.5%">实际</div>
            <div class="biao7" v-for="(item, index) in pagoda" :key="index" style="width:14.5%">{{
              item.title == undefined ? '' : Math.floor(item.product_energy * 100) / 100 }}
            </div>
          </div>
          <div style="display:flex;">
            <div class="biao5" style="width:14.5%">占比</div>
            <div class="biao7" v-for="(item, index) in pagoda" :key="index" style="width:14.5%">
              <!-- {{ item.title==undefined?'':item.product_energy==0? 0+'%':item.product_energy>item.systam_down && item.product_energy< item.systam_up? 100+'%' : item.product_energy<item.systam_down? '-'+ Math.floor((((item.systam_down-item.product_energy)/item.systam_down)*100)*100)/100 +'%' : item.product_energy>item.systam_up? '+'+ Math.floor((((item.product_energy-item.systam_down)/item.systam_down)*100)*100)/100 +'%':''}} -->
              {{ item.product_energy < item.systam_down ? Math.floor((item.product_energy - item.systam_down) /
                item.systam_down * 100 * 100) / 100 + '%' : item.product_energy >= item.systam_down &&
                  item.product_energy <= item.systam_up ? 100 + '%' : item.product_energy > item.systam_up ? '+' +
                    Math.floor(((item.product_energy - item.systam_up) / item.systam_up + 1) * 100 * 100) / 100 + '%' : ''
              }}
            </div>
          </div>
        </div>

        <!-- 儿童膳食结构(FFQ)与膳食分析报告单 -->
        <!-- <div >
          <div style=" width: 100%; background-color:#2ab28b;  text-align: center; margin:auto">
            <div style="font-size: 40px; font-weight: bold; color: #ffffff;padding-top:20px;">{{ Titlename }}</div>
            <span style="font-size: 30px; color: #666666; margin-left: 20px;display: block;">基本信息报告</span>
            <div
              style="margin-top:30px;font-size: 24px;padding-bottom: 20px;font-weight: bold;padding-top: 20px;color:#333333;">
              儿童膳食结构(FFQ)与膳食分析报告单</div>
          </div>
        </div> -->
        <ChildViewDietary></ChildViewDietary>
        <!-- <div v-if="code_1=='true'" style="margin-top: 20px;height:150px;text-align: end;margin-right: 50px;margin-bottom:10px;">
            <img style="width: 100px;height:100px;" :src="'http://' + baseUrl + '/' +codeimg" alt="">
            <div style="margin-top:10px;font-size: 20px;font-weight: bold;">
                扫码关注公众号,获取在线报告
            </div>
        </div> -->

        <!-- 能量摄入量分析 -->
        <!-- <div style="width: 100%;height: 40px; background-color: rgb(42, 178, 139);margin-top: 10px;display: flex;page-break-before: always;">
            <div><img src="../assets/img/17.jpg" style="height: 40px" alt="" /></div>
            <div style="font-size: 20px;margin-left: 10px;line-height: 40px;color:#fff;">
              能量&营养摄入量分析
            </div>
          </div>
          <div style="width:1071px;border:2px solid #09a578;margin:20px auto;">
            <div style="display:flex">
              <div class="biao1"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;">能量</div>
              <div class="biao4" style="width:90%;padding-left: 5px;">
                <div v-html="energys">
                </div>
              </div>
            </div>
            <div style="display:flex">
              <div class="biao1"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;">蛋白质</div>
              <div class="biao4" style="width:90%;padding-left: 5px;">
                <div v-html="proteins">
                </div>
              </div>
            </div>
            <div style="display:flex">
              <div class="biao1"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;">脂肪</div>
              <div class="biao4" style="width:90%;padding-left: 5px;">
                <div v-html="fats">
                </div>
              </div>
            </div>
            <div style="display:flex">
              <div class="biao1"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;"> 碳水化合物
              </div>
              <div class="biao4" style="width:90%;padding-left: 5px;">
                <div v-html="carbohydrates">
                </div>
              </div>
            </div>
            <div style="display:flex">
              <div class="biao1"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;">钙</div>
              <div class="biao4" style="width:90%;padding-left: 5px;">
                <div v-html="calciums">
                </div>
              </div>
            </div>
            <div style="display:flex">
              <div class="biao1"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;"> 铁</div>
              <div class="biao4" style="width:90%;padding-left: 5px;">
                <div v-html="irons">
                </div>
              </div>
            </div>
            <div style="display:flex">
              <div class="biao1"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;"> 锌</div>
              <div class="biao4" style="width:90%;padding-left: 5px;">
                <div v-html="zincs">
                </div>
              </div>
            </div>
            <div style="display:flex">
              <div class="biao1"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;"> 硒</div>
              <div class="biao4" style="width:90%;padding-left: 5px;">
                <div v-html="seleniums">
                </div>
              </div>
            </div>
            <div style="display:flex">
              <div class="biao1"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;"> 维生素A
              </div>
              <div class="biao4" style="width:90%;padding-left: 5px;">
                <div v-html="vitamin_as">
                </div>
              </div>
            </div>
            <div style="display:flex">
              <div class="biao1"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;"> 维生素B1
              </div>
              <div class="biao4" style="width:90%;padding-left: 5px;">
                <div v-html="vitamin_b1s">
                </div>
              </div>
            </div>
            <div style="display:flex">
              <div class="biao5"
                style="width:10%;line-height:20px;display: flex;justify-content: center;align-items: center;"> 维生素C
              </div>
              <div class="biao7" style="width:90%;padding-left: 5px;">
                <div v-html="vitamin_cs">
                </div>
              </div>
            </div>
          </div> -->

          <!-- <div  style="width: 100%;height: 30px;background-color: rgb(42, 178, 139);margin-top: 10px;display: flex;">
            <div><img src="../assets/img/15.jpg" style="height: 30px" alt="" /></div>
            <div style="font-size: 20px;margin-left: 10px;line-height: 30px;color:#fff;">
              餐次能量分析
            </div>
          </div>
          <div style="display: flex;margin-top: 10px;text-align: center;">  
            <div class="biao7" style="width: 16.5%;background-color: #09a578;color: #ffffff;height:40px;line-height: 40px;">早餐</div>
            <div class="biao7" style="width: 16.5%;background-color: #09a578;color: #ffffff;height:40px;line-height: 40px;">早加餐</div>
            <div class="biao7" style="width: 16.5%;background-color: #09a578;color: #ffffff;height:40px;line-height: 40px;">午餐</div>
            <div class="biao7" style="width: 16.5%;background-color: #09a578;color: #ffffff;height:40px;line-height: 40px;">午加餐</div>
            <div class="biao7" style="width: 16.5%;background-color: #09a578;color: #ffffff;height:40px;line-height: 40px;">晚餐</div>
            <div class="biao7" style="width: 16.5%;background-color: #09a578;color: #ffffff;height:40px;line-height: 40px;">晚加餐</div>
          </div>
          <div style="display: flex;text-align: center;">  
            <div class="biao7" style="width: 16.5%;height:40px;line-height: 40px;">{{(Math.floor(Breakfastenergy/(Breakfastenergy+Lunchenergy+Dinnerenergy+Noonenergy+Morningenergy+Lateenergy)*100 * 100) / 100 + '%')}}</div>
            <div class="biao7" style="width: 16.5%;height:40px;line-height: 40px;">{{(Math.floor(Morningenergy/(Breakfastenergy+Lunchenergy+Dinnerenergy+Noonenergy+Morningenergy+Lateenergy)*100 * 100) / 100 + '%')}}</div>
            <div class="biao7" style="width: 16.5%;height:40px;line-height: 40px;">{{(Math.floor(Lunchenergy/(Breakfastenergy+Lunchenergy+Dinnerenergy+Noonenergy+Morningenergy+Lateenergy)*100 * 100) / 100 + '%')}}</div>
            <div class="biao7" style="width: 16.5%;height:40px;line-height: 40px;">{{(Math.floor(Noonenergy/(Breakfastenergy+Lunchenergy+Dinnerenergy+Noonenergy+Morningenergy+Lateenergy)*100 * 100) / 100 + '%')}}</div>
            <div class="biao7" style="width: 16.5%;height:40px;line-height: 40px;">{{(Math.floor(Dinnerenergy/(Breakfastenergy+Lunchenergy+Dinnerenergy+Noonenergy+Morningenergy+Lateenergy)*100 * 100) / 100 + '%')}}</div>
            <div class="biao7" style="width: 16.5%;height:40px;line-height: 40px;">{{(Math.floor(Lateenergy/(Breakfastenergy+Lunchenergy+Dinnerenergy+Noonenergy+Morningenergy+Lateenergy)*100 * 100) / 100 + '%')}}</div>
          </div> -->



          <!-- 膳食宝塔 -->
          <!-- <div style="page-break-before: always;">
            <div v-if="monthsDifference<=6" style="display: flex;justify-content: space-between;">
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/1.jpg" alt="">
              </div>
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/2.jpg" alt="">
              </div>
            </div>
            <div v-if="monthsDifference>6 && monthsDifference<=24" style="display: flex;justify-content: space-between;">
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/2.jpg" alt="">
              </div>
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/3.jpg" alt="">
              </div>
            </div>
            <div v-if="monthsDifference>24 && monthsDifference<=60" style="display: flex;justify-content: space-between;">
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/3.jpg" alt="">
              </div>
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/4.jpg" alt="">
              </div>
            </div>
            <div v-if="monthsDifference>60 && monthsDifference<=120" style="display: flex;justify-content: space-between;">
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/3.jpg" alt="">
              </div>
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/4.jpg" alt="">
              </div>
            </div>
            <div v-if="monthsDifference>120 && monthsDifference<=156" style="display: flex;justify-content: space-between;">
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/4.jpg" alt="">
              </div>
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/5.jpg" alt="">
              </div>
            </div>
            <div v-if="monthsDifference>156 && monthsDifference<=204" style="display: flex;justify-content: space-between;">
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/5.jpg" alt="">
              </div>
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/6.jpg" alt="">
              </div>
            </div>
            <div v-if="monthsDifference>204" style="display: flex;justify-content: space-between;">
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/6.jpg" alt="">
              </div>
              <div style="width: 100%;">
                <img style="width: 100%;" src="../../public/staic/img/7.jpg" alt="">
              </div>
            </div>
          </div> -->


          <!-- <div style="width: 100%;height: 40px;background-color: rgb(42, 178, 139);margin-top: 10px;display: flex;">
            <div><img src="../assets/img/26.jpg" style="height: 40px" alt="" /></div>
            <div style="font-size: 20px;margin-left: 10px;line-height: 40px;color:#fff;">
              喂养建议
            </div>
          </div>
          <div style="width: 1050px;border: 2px solid #09a578;min-height: 100px;margin-top: 20px;padding: 10px 10px;">
            <textarea name="" id="" cols="30" rows="10" style="width:100%;border:none;resize: none;outline: none;"
              v-model="FeedingRecommendations"></textarea>

          </div> -->
          <!-- 评估指导 -->
          <!-- <div style="width: 100%;height: 40px;background-color: rgb(42, 178, 139);margin-top: 10px;display: flex;">
            <div><img src="../assets/img/27.jpg" style="height: 40px" alt="" /></div>
            <div style="font-size: 20px;margin-left: 10px;line-height: 40px;color:#fff;">
              营养建议
            </div>
          </div>
          <div style="width: 1050px;border: 2px solid #09a578;min-height: 100px; margin-top: 20px;padding: 10px 10px;">
            <textarea name="" id="" cols="30" rows="10" style="width:100%;border:none;resize: none;outline: none;"
              v-model="NutritionRecommendations"></textarea>
          </div> -->
          <!-- 医生建议 -->
          <div style="width: 100%;height: 40px;background-color: rgb(42, 178, 139);margin-top: 10px;display: flex;">
            <div><img src="../assets/img/27.jpg" style="height: 40px" alt="" /></div>
            <div style="font-size: 20px;margin-left: 10px;line-height: 40px;color:#fff;">
              医生建议
            </div>
          </div>
          <div style="width: 1050px;border: 2px solid #09a578;min-height: 100px; margin-top: 20px;padding: 10px 10px;">
            <textarea name="" id="" cols="30" rows="10" style="width:100%;border:none;resize: none;outline: none;"
              v-model="DoctorRecommendations"></textarea>
          </div>
          <div style="width: 100%;height: 40px;background-color: rgb(42, 178, 139);margin-top: 10px;display: flex;">
            <div><img src="../assets/img/27.jpg" style="height: 40px" alt="" /></div>
            <div style="font-size: 20px;margin-left: 10px;line-height: 40px;color:#fff;">
              复诊预约
            </div>
          </div>
          <div style="width: 30%;height: 40px;border: 2px solid #09a578;margin-top: 20px;margin-bottom: 20px;">
            <div
              style=" width: 42%;line-height: 40px;background-color: rgb(42, 178, 139);color:#fff;height: 100%;text-align: center;border-right: 2px solid #09a578;">
              医师签字
            </div>
            <div></div>
          </div>

        
</div>
  </template>
    
  <script setup>
  import { Edit, CirclePlus, Search, Expand, } from '@element-plus/icons-vue'
  import { defineComponent, onMounted, ref, watch, reactive } from 'vue'
  import Header from './common/Header.vue';
  import ChildLeft from './common/ChildLeft.vue';
  import { useRoute, useRouter } from "vue-router"
  import ChildViewcomposition from './common/ChildViewcomposition.vue';
  import http, { baseUrl } from "../utils/http";
  import Drawer from './common/Drawer.vue';
  import ChildViewDietary from './common/ChildVD2.vue';
  import { ElMessage, ElMessageBox } from "element-plus";
  import * as api from "../api/loginHttp";
  import * as echarts from 'echarts';
  const route = useRoute()
  const code_1 = ref(false)
  const router = useRouter()
  const diet_analysis = ref({})
  const myChart = ref()
const myChart1 = ref()
const myChart2 = ref()
  const labName = ref()
  const options = ref([{
    value: '早餐',
    label: '早餐',
  },
  {
    value: '中餐',
    label: '中餐',
  },
  {
    value: '晚餐',
    label: '晚餐',
  },])
  const checkList = ref([])
  const tan = ref(true)
  const loadings = ref(true)
  const list = ref({})
  const Catering=ref(['','早餐','午餐','晚餐'])
const element1=ref(['菜名','能量','蛋白质','碳水化合物','脂肪','钙','钠','镁','铁','锌','硒','维生素A','维生素E','维生素B1','维生素B2','维生素C','份数']);
  const codeimg=ref()
  const energy = ref(0)
  const energys = ref()
  const OilEnergy = ref(0)
  const fats = ref({})
  const drawer = ref(false)
  const kcalType = ref(2)
const BreakfastLists=ref()
const LunchLists=ref()
const DinnerLists=ref()
const pagoda = ref({})
  const Diseaseanalysis=ref()
  const radio1 = ref('')
  const radio2 = ref('')
  const times=ref()
  const radio3 = ref('')
  const radio4 = ref('')
  const sodiums = ref({})
  const magnesiums = ref({})
  const total = ref(0)
  const userinfo = ref({})
  const Prints = ref('true')
  const Titlename = ref()
  const contents = ref({})
  const reportId = ref();
  const username = ref();
  const guardian = ref();
  const birth = ref();
  const birthStatus = ref();
  const report_time = ref();
  const foodIntervention=ref();
  const monthsDifference=ref();
  const Breakfastenergy=ref(0);//早餐能量
const Morningenergy=ref(0);//早点能量
const Lunchenergy=ref(0);//午餐能量
const Noonenergy=ref(0);//午点能量
const Dinnerenergy=ref(0);//晚餐能量
const Lateenergy=ref(0);//晚点能量
const BreakfastrecommendationMin=ref();//早餐推荐
const BreakfastrecommendationMax=ref();//早餐推荐
const LunchrecommendationsMin=ref();//午餐推荐
const LunchrecommendationsMax=ref();//午餐推荐
const DinnerrecommendationMin=ref();//晚餐推荐
const DinnerrecommendationMax=ref();//晚餐推荐
const BreakfastList=ref();
const data = ref()
const FeedingRecommendations = ref()
const NutritionRecommendations = ref()
const DoctorRecommendations = ref()
const carbohydrates = ref({})
const LunchList=ref();
const DinnerList=ref();
const principle = ref({});
const protein = ref({ energy: 0, start: 0, end: 0 });
const proteins = ref({});
const letEnergy = ref({ energy: 0, start: 0, end: 0 });
const fat = ref({ energy: 0, start: 0, end: 0 });
const carbohydrate = ref({ energy: 0, start: 0, end: 0 });
const calcium = ref({ energy: 0, start: 0, end: 0 });
const sodium = ref({ energy: 0, start: 0, end: 0 });
const magnesium = ref({ energy: 0, start: 0, end: 0 });
const iron = ref({ energy: 0, start: 0, end: 0 });
const zinc = ref({ energy: 0, start: 0, end: 0 });
const zincs = ref({})
const selenium = ref({ energy: 0, start: 0, end: 0 });
const seleniums = ref({})
const vitamin_a = ref({ energy: 0, start: 0, end: 0 });
const calciums = ref({})
const irons = ref({})
const vitamin_as = ref({})
const vitamin_e = ref({ energy: 0, start: 0, end: 0 });
const vitamin_es = ref({})
const vitamin_b1 = ref({ energy: 0, start: 0, end: 0 });
const vitamin_b1s = ref({})
const vitamin_b2 = ref({ energy: 0, start: 0, end: 0 });
const vitamin_b2s = ref({})
const vitamin_c = ref({ energy: 0, start: 0, end: 0 });
const vitamin_cs = ref({})
const BMI=ref();
const Height_s = ref()
const Weight_s = ref()
  
  const groupId = ref()
  const id = ref()
  const popWrite = ref(false)
  const popWriteDirection = ref('ttb')
  const pageList = async () => {
    await router.push({ 'path': '/pageList/' + groupId.value })
  }
  const size = ref('150%')
  
  const formInline = ref({
    Fat: '',
    FatMin: '',
    FatMax: '',
    Bone: '',
    BoneMin: '',
    BoneMax: '',
    Protein: '',
    ProteinMin: '',
    ProteinMax: '',
    Water: '',
    WaterMin: '',
    WaterMax: '',
    LBM: '',
    ICW: '',
    Weight: '',
    WeightMin: '',
    WeightMax: '',
    Muscle: '',
    MuscleMin: '',
    MuscleMax: '',
    PBF: '',
    PBFMin: '',
    PBFMax: '',
    SMM: '',
    SMMMin: '',
    SMMMax: '',
    BMI: '',
    BMIMin: '',
    BMIMax: '',
    WHR: '',
    WHRMin: '',
    WHRMax: '',
    Weight_control: '',
    Fat_control: '',
    Muscle_control: '',
    VFI: '',
    VFIMin: '',
    VFIMax: '',
    Edema: '',
    EdemaMin: '',
    EdemaMax: '',
    ECW: '',
    BMR: '',
    name: '',
  })
  
  const onHome = async () => {
    await router.push({ 'path': '/Home' })
  }
  const radi1 = () => {
    total.value = parseInt(radio1.value) + parseInt(radio2.value) + parseInt(radio3.value) + parseInt(radio4.value);
  }
  const radi2 = () => {
    total.value = parseInt(radio1.value) + parseInt(radio2.value) + parseInt(radio3.value) + parseInt(radio4.value);
  }
  const radi3 = () => {
    total.value = parseInt(radio1.value) + parseInt(radio2.value) + parseInt(radio3.value) + parseInt(radio4.value);
  }
  const radi4 = () => {
    total.value = parseInt(radio1.value) + parseInt(radio2.value) + parseInt(radio3.value) + parseInt(radio4.value);
  }
  const onChange = async (index, value) => {
    list._rawValue[index].energy = (list._rawValue[index].single.energy * value).toFixed(2)
    list._rawValue[index].weight = (list._rawValue[index].single.weight * value).toFixed(2)
    list._rawValue[index].protein = (list._rawValue[index].single.protein * value).toFixed(2)
    list._rawValue[index].fat = (list._rawValue[index].single.fat * value).toFixed(2)
    list._rawValue[index].carbohydrate = (list._rawValue[index].single.carbohydrate * value).toFixed(2)
    list._rawValue[index].calcium = (list._rawValue[index].single.calcium * value).toFixed(2)
    list._rawValue[index].sodium = (list._rawValue[index].single.sodium * value).toFixed(2)
    list._rawValue[index].magnesium = (list._rawValue[index].single.magnesium * value).toFixed(2)
    list._rawValue[index].iron = (list._rawValue[index].single.iron * value).toFixed(2)
    list._rawValue[index].zinc = (list._rawValue[index].single.zinc * value).toFixed(2)
    list._rawValue[index].selenium = (list._rawValue[index].single.selenium * value).toFixed(2)
    list._rawValue[index].vitamin_a = (list._rawValue[index].single.vitamin_a * value).toFixed(2)
    list._rawValue[index].vitamin_e = (list._rawValue[index].single.vitamin_e * value).toFixed(2)
    list._rawValue[index].vitamin_b1 = (list._rawValue[index].single.vitamin_b1 * value).toFixed(2)
    list._rawValue[index].vitamin_b2 = (list._rawValue[index].single.vitamin_b2 * value).toFixed(2)
    list._rawValue[index].vitamin_c = (list._rawValue[index].single.vitamin_c * value).toFixed(2)
  
    energys.value = 0
    for (let i = 0; i < list._rawValue.length; i++) {
      energys.value += (list._rawValue[i].energy) * 1;
      console.log(list._rawValue[i].energy)
  
    }
  
  }
  
  const btn_fenxi = async () => {
    let params = {
      'id': reportId.value,
      'user_id': id.value,
      'diet_energy': energy._value,
      'diet': list._rawValue,
    }
  
 
  
    if (data.data.code == 0) {
      ElMessage.error(data.data.msg)
      return false;
    } else {
      const { href } = await router.resolve({
        path: "/Dietary/" + groupId.value + "/" + id.value + '/' + reportId.value
      });
      window.open(href, "_blank");
    }
  
  }
  
  const cancelClick = async () => {
    popWrite.value = false;
  }
  
  const confirmClick = async () => {
    Object.keys(formInline._rawValue).forEach(function (item, index) {
      //item 就是当日按循环到的对象
      //index是循环的索引，从0开始
      if (formInline._rawValue[item] == '') {
        ElMessage.error('必填项不能为空')
        return;
      }
      // console.log(formInline._rawValue[item]);
    })
  
  
  
    // for(let i = 0; i < Object.keys(formInline._rawValue).length; i++) {
    //   console.log(i);
    //   console.log(formInline._rawValue[i]);
    //   if (formInline.value[i] == '') {
    //     ElMessage.error('必填项不能为空')
    //     return false;
    //   }
    // }
  }
  
  const get_new = async () => {
    const res = await api.getFood();
  }
  
  // const handClick = async ()  => {
  //   console.log('手动输入体成分数据');
  // }
  
  const handClick = async () => {
    popWrite.value = true;
  }
  
  
  
  const appraisal = async () => {
    http.get('api/archives/analysis?id=' + id.value + '&type=analysis').then((res) => {
      if (res.data.code === 0) {
        ElMessage.error(res.data.msg)
      }
    })
  }
  
  const guanbi = async () => {
    tan.value = false;
    http.get('api/archives/analysis?id=' + id.value + '&type=cancel').then((res) => {
      if (res.data.code === 0) {
        ElMessage.error(res.data.msg)
      }
    })
  }
  
  const goto = async () => {
    const { href } = await router.resolve({
      path: "/analysis/" + groupId.value + "/" + id.value + "/" + reportId.value
    });
    window.open(href, "_blank");
  }
  
  
  const btn = async () => {
    // // 只要点击文档，那么就将数据保存起来
    http.get('api/archives/setReportStatus?reportId=' + reportId.value).then((res) => {
      if (res.data.code === 0) {
        ElMessage.error(res.data.msg)
        return false
      }
    })
    const { href } = await router.resolve({
      path: "/reportView/" + groupId.value + "/" + id.value + "/" + reportId.value
    });
    window.open(href, "_blank");
  }
  
  const fetchData = async () => {
    //获取医院名称
    Titlename.value = localStorage.getItem('Title');
    if (parseInt(radio1.value)) {
      total.value = parseInt(radio1.value) + parseInt(radio2.value) + parseInt(radio3.value) + parseInt(radio4.value);
    } else {
      total.value = 0;
    }
    //获取个人信息
    if (route.params.groupId) {
      groupId.value = route.params.groupId;
      id.value = route.params.id;
      reportId.value = route.params.reportId;
      username.value = route.params.username;
      guardian.value = route.params.guardian;
      birthStatus.value = route.params.birth;
      codeimg.value=window.localStorage.getItem('ercode')
  
      
      //获取二维码是否显示
    http.get('api/index/getAuth').then((res)=>{
        let aray=res.data.data;
        let array=aray.split(',');
        if(array.includes('12')){
          code_1.value='true'
        }else{
          code_1.value='false'
        }
      })
  
    

    }
    function getMonthsDifference(startDateStr, endDateStr) {
          const startDate = new Date(startDateStr);
          const endDate = new Date(endDateStr);

          // 确保开始日期早于结束日期
          if (startDate > endDate) {
              throw new Error('开始日期必须早于结束日期');
          }

          // 计算年份差
          let yearsDiff = endDate.getFullYear() - startDate.getFullYear();
          // 计算月份差
          let monthsDiff = endDate.getMonth() - startDate.getMonth();

          // 如果结束日期的月份小于开始日期的月份，说明跨年了，年份差减一，月份差加上一年的月份数
          if (monthsDiff < 0) {
              yearsDiff--;
              monthsDiff += 12;
          }

          // 合并年份差和月份差
          let totalMonthsDiff = yearsDiff * 12 + monthsDiff;

          return totalMonthsDiff;
      }
      let params = {
    'groupId': groupId.value,
    'id': id.value,
    'reportId': reportId.value,
    'username': username.value,
    'guardian': guardian.value,
    'birth': birth.value,
  }
  const data = await api.energy(params);
  if(data.data.data.packAge.length>0){
    BreakfastrecommendationMin.value=data.data.data.packAge[0].start_package*0.3;
    BreakfastrecommendationMax.value=data.data.data.packAge[0].end_package*0.3;
    LunchrecommendationsMin.value=data.data.data.packAge[0].start_package*0.4;
    LunchrecommendationsMax.value=data.data.data.packAge[0].end_package*0.4;
    DinnerrecommendationMin.value=data.data.data.packAge[0].start_package*0.3;
    DinnerrecommendationMax.value=data.data.data.packAge[0].end_package*0.3;

  }
    
      http.get("api/archives/viewReportMember?id=" + reportId.value + "&username=" + '' + "&guardian=" + '' + "&birth=" + '').then((res) => {
        if (res.data.data.times) {
          let parsedDate = new Date(res.data.data.times);
          let targetDateObj = new Date('2024-01-08');
          if (parsedDate < targetDateObj) {
            times.value = 1;
          } else if (parsedDate > targetDateObj) {
            times.value = 2;
          }
        }
  
        
        if (res.data.code === 0) {
          ElMessage.error(res.data.msg);
        }
        report_time.value = res.data.data.times;
       
        birth.value = res.data.data.contents.birth;
        const startDateStr = res.data.data.contents.birth;
        const endDateStr = new Date().toISOString().split('T')[0];
        monthsDifference.value=getMonthsDifference(startDateStr, endDateStr);
        
     if (res.data.data.feed_advice) {
      FeedingRecommendations.value = res.data.data.feed_advice
    }
    if (res.data.data.nutrition_advice) {
      NutritionRecommendations.value = res.data.data.nutrition_advice
    }
    if (res.data.data.doctor_advice) {
      DoctorRecommendations.value = res.data.data.doctor_advice
    }

     

  for (let i = 0; i < data.data.data.diet_analysis.length; i++) {
    switch (i) {
      case 0:
        data.data.data.diet_analysis[i]['pName'] = '周一';
        break
      case 1:
        data.data.data.diet_analysis[i]['pName'] = '周二';
        break
      case 2:
        data.data.data.diet_analysis[i]['pName'] = '周三';
        break
      case 3:
        data.data.data.diet_analysis[i]['pName'] = '周四';
        break
      case 4:
        data.data.data.diet_analysis[i]['pName'] = '周五';
        break
      case 5:
        data.data.data.diet_analysis[i]['pName'] = '周六';
        break
      case 6:
        data.data.data.diet_analysis[i]['pName'] = '周日';
        break
    }
  }

  diet_analysis.value = data.data.data.diet_analysis;
  for (let i = 0; i < data.data.data.diet.length; i++) {

if (parseInt(data.data.data.diet[i]['energy']) !== parseInt(data.data.data.diet[i]['energy'])) {
  data.data.data.diet[i]['energy'] = 0;
}
if (parseInt(data.data.data.diet[i]['protein']) !== parseInt(data.data.data.diet[i]['protein'])) {
  data.data.data.diet[i]['protein'] = 0;
}
if (parseInt(data.data.data.diet[i]['fat']) !== parseInt(data.data.data.diet[i]['fat'])) {
  data.data.data.diet[i]['fat'] = 0;
}
if (parseInt(data.data.data.diet[i]['carbohydrate']) !== parseInt(data.data.data.diet[i]['carbohydrate'])) {
  data.data.data.diet[i]['carbohydrate'] = 0;
}
if (parseInt(data.data.data.diet[i]['calcium']) !== parseInt(data.data.data.diet[i]['calcium'])) {
  data.data.data.diet[i]['calcium'] = 0;
}
if (parseInt(data.data.data.diet[i]['sodium']) !== parseInt(data.data.data.diet[i]['sodium'])) {
  data.data.data.diet[i]['sodium'] = 0;
}
if (parseInt(data.data.data.diet[i]['magnesium']) !== parseInt(data.data.data.diet[i]['magnesium'])) {
  data.data.data.diet[i]['magnesium'] = 0;
}
if (parseInt(data.data.data.diet[i]['iron']) !== parseInt(data.data.data.diet[i]['iron'])) {
  data.data.data.diet[i]['iron'] = 0;
}
if (parseInt(data.data.data.diet[i]['zinc']) !== parseInt(data.data.data.diet[i]['zinc'])) {
  data.data.data.diet[i]['zinc'] = 0;
}
if (parseInt(data.data.data.diet[i]['selenium']) !== parseInt(data.data.data.diet[i]['selenium'])) {
  data.data.data.diet[i]['selenium'] = 0;
}
if (parseInt(data.data.data.diet[i]['vitamin_a']) !== parseInt(data.data.data.diet[i]['vitamin_a'])) {
  data.data.data.diet[i]['vitamin_a'] = 0;
}
if (parseInt(data.data.data.diet[i]['vitamin_e']) !== parseInt(data.data.data.diet[i]['vitamin_e'])) {
  data.data.data.diet[i]['vitamin_e'] = 0;
}
if (parseInt(data.data.data.diet[i]['vitamin_b1']) !== parseInt(data.data.data.diet[i]['vitamin_b1'])) {
  data.data.data.diet[i]['vitamin_b1'] = 0;
}
if (parseInt(data.data.data.diet[i]['vitamin_b2']) !== parseInt(data.data.data.diet[i]['vitamin_b2'])) {
  data.data.data.diet[i]['vitamin_b2'] = 0;
}
if (parseInt(data.data.data.diet[i]['vitamin_c']) !== parseInt(data.data.data.diet[i]['vitamin_c'])) {
  data.data.data.diet[i]['vitamin_c'] = 0;
}
letEnergy._value.energy = letEnergy._value.energy + (data.data.data.diet[i]['energy']) * 1;
protein._value.energy = protein._value.energy + (data.data.data.diet[i]['protein']) * 1;
fat._value.energy = fat._value.energy + (data.data.data.diet[i]['fat']) * 1;
carbohydrate._value.energy = carbohydrate._value.energy + (data.data.data.diet[i]['carbohydrate']) * 1;
calcium._value.energy = calcium._value.energy + (data.data.data.diet[i]['calcium']) * 1;
sodium._value.energy = sodium._value.energy + (data.data.data.diet[i]['sodium']) * 1;
magnesium._value.energy = magnesium._value.energy + (data.data.data.diet[i]['magnesium']) * 1;
iron._value.energy = iron._value.energy + (data.data.data.diet[i]['iron']) * 1;
zinc._value.energy = zinc._value.energy + (data.data.data.diet[i]['zinc']) * 1;
selenium._value.energy = selenium._value.energy + (data.data.data.diet[i]['selenium']) * 1;
vitamin_a._value.energy = vitamin_a._value.energy + (data.data.data.diet[i]['vitamin_a']) * 1;
vitamin_e._value.energy = vitamin_e._value.energy + (data.data.data.diet[i]['vitamin_e']) * 1;
vitamin_b1._value.energy = vitamin_b1._value.energy + (data.data.data.diet[i]['vitamin_b1']) * 1;
vitamin_b2._value.energy = vitamin_b2._value.energy + (data.data.data.diet[i]['vitamin_b2']) * 1;
vitamin_c._value.energy = vitamin_c._value.energy + (data.data.data.diet[i]['vitamin_c']) * 1;
}

letEnergy._value.energy = (letEnergy._value.energy).toFixed(2);
protein._value.energy = (protein._value.energy).toFixed(2);
fat._value.energy = (fat._value.energy).toFixed(2);
carbohydrate._value.energy = (carbohydrate._value.energy).toFixed(2);
calcium._value.energy = (calcium._value.energy).toFixed(2);
sodium._value.energy = (sodium._value.energy).toFixed(2);
magnesium._value.energy = (magnesium._value.energy).toFixed(2);
iron._value.energy = (iron._value.energy).toFixed(2);
zinc._value.energy = (zinc._value.energy).toFixed(2);
selenium._value.energy = (selenium._value.energy).toFixed(2);
vitamin_a._value.energy = (vitamin_a._value.energy).toFixed(2);
vitamin_e._value.energy = (vitamin_e._value.energy).toFixed(2);
vitamin_b1._value.energy = (vitamin_b1._value.energy).toFixed(2);
vitamin_b2._value.energy = (vitamin_b2._value.energy).toFixed(2);
vitamin_c._value.energy = (vitamin_c._value.energy).toFixed(2);

letEnergy._value.start = data.data.data.packAge[0].start_package;
letEnergy._value.end = data.data.data.packAge[0].end_package;
letEnergy._value.keyword = '✔ 正常';
letEnergy._value.color = 'everyBlack';
 //能量
 if (letEnergy._value.energy < letEnergy._value.start) {

letEnergy._value.keyword = '▼ 不足';
letEnergy._value.color = 'everyRed';
kcalType.value = 3
} else if (letEnergy._value.energy > letEnergy._value.end) {

letEnergy._value.keyword = '▲ 超标';
letEnergy._value.color = 'everyOrange';
kcalType.value = 1
}

//蛋白质
protein._value.start = data.data.data.packAge[1].start_package;
protein._value.end = data.data.data.packAge[1].end_package;
protein._value.keyword = '✔ 正常';
protein._value.color = 'everyBlack';
if (protein._value.energy < protein._value.start) {
protein._value.keyword = '▼ 不足';
protein._value.color = 'everyRed';
} else if (protein._value.energy > protein._value.end) {
protein._value.keyword = '▲ 超标';
protein._value.color = 'everyOrange';
}
//脂肪
fat._value.start = data.data.data.packAge[2].start_package;
fat._value.end = data.data.data.packAge[2].end_package;
fat._value.keyword = '✔ 正常';
fat._value.color = 'everyBlack';
if (fat._value.energy < fat._value.start) {
fat._value.keyword = '▼ 不足';
fat._value.color = 'everyRed';
} else if (fat._value.energy > fat._value.end) {
fat._value.keyword = '▲ 超标';
fat._value.color = 'everyOrange';
}
//碳水化合物
carbohydrate._value.start = data.data.data.packAge[3].start_package;
carbohydrate._value.end = data.data.data.packAge[3].end_package;
carbohydrate._value.keyword = '✔ 正常';
carbohydrate._value.color = 'everyBlack';
if (carbohydrate._value.energy < carbohydrate._value.start) {
carbohydrate._value.keyword = '▼ 不足';
carbohydrate._value.color = 'everyRed';
} else if (carbohydrate._value.energy > carbohydrate._value.end) {
carbohydrate._value.keyword = '▲ 超标';
carbohydrate._value.color = 'everyOrange';
}

//钙
calcium._value.start = data.data.data.packAge[4].start_package;
calcium._value.end = data.data.data.packAge[4].end_package;
calcium._value.keyword = '✔ 正常';
calcium._value.color = 'everyBlack';
if (calcium._value.energy < calcium._value.start) {
calcium._value.keyword = '▼ 不足';
calcium._value.color = 'everyRed';
} else if (calcium._value.energy > calcium._value.end) {
calcium._value.keyword = '▲ 超标';
calcium._value.color = 'everyOrange';
}
//钠
sodium._value.start = data.data.data.packAge[5].start_package;
sodium._value.end = data.data.data.packAge[5].end_package;
sodium._value.keyword = '✔ 正常';
sodium._value.color = 'everyBlack';
if (sodium._value.energy < sodium._value.start) {
sodium._value.keyword = '▼ 不足';
sodium._value.color = 'everyRed';
} else if (sodium._value.energy > sodium._value.end) {
sodium._value.keyword = '▲ 超标';
sodium._value.color = 'everyOrange';
}
//镁
magnesium._value.start = data.data.data.packAge[6].start_package;
magnesium._value.end = data.data.data.packAge[6].end_package;
magnesium._value.keyword = '✔ 正常';
magnesium._value.color = 'everyBlack';
if (magnesium._value.energy < magnesium._value.start) {
magnesium._value.keyword = '▼ 不足';
magnesium._value.color = 'everyRed';
} else if (magnesium._value.energy > magnesium._value.end) {
magnesium._value.keyword = '▲ 超标';
magnesium._value.color = 'everyOrange';
}
//铁
iron._value.start = data.data.data.packAge[7].start_package;
iron._value.end = data.data.data.packAge[7].end_package;
iron._value.keyword = '✔ 正常';
iron._value.color = 'everyBlack';
if (iron._value.energy < iron._value.start) {
iron._value.keyword = '▼ 不足';
iron._value.color = 'everyRed';
} else if (iron._value.energy > iron._value.end) {
iron._value.keyword = '▲ 超标';
iron._value.color = 'everyOrange';
}
//锌
zinc._value.start = data.data.data.packAge[8].start_package;
zinc._value.end = data.data.data.packAge[8].end_package;
zinc._value.keyword = '✔ 正常';
zinc._value.color = 'everyBlack';
if (zinc._value.energy < zinc._value.start) {
zinc._value.keyword = '▼ 不足';
zinc._value.color = 'everyRed';
} else if (zinc._value.energy > zinc._value.end) {
zinc._value.keyword = '▲ 超标';
zinc._value.color = 'everyOrange';
}
//硒
selenium._value.start = data.data.data.packAge[9].start_package;
selenium._value.end = data.data.data.packAge[9].end_package;
selenium._value.keyword = '✔ 正常';
selenium._value.color = 'everyBlack';
if (selenium._value.energy < selenium._value.start) {
selenium._value.keyword = '▼ 不足';
selenium._value.color = 'everyRed';
} else if (selenium._value.energy > selenium._value.end) {
selenium._value.keyword = '▲ 超标';
selenium._value.color = 'everyOrange';
}
// 维生素A
vitamin_a._value.start = data.data.data.packAge[10].start_package;
vitamin_a._value.end = data.data.data.packAge[10].end_package;
vitamin_a._value.keyword = '✔ 正常';
vitamin_a._value.color = 'everyBlack';
if (vitamin_a._value.energy < vitamin_a._value.start) {
vitamin_a._value.keyword = '▼ 不足';
vitamin_a._value.color = 'everyRed';
} else if (vitamin_a._value.energy > vitamin_a._value.end) {
vitamin_a._value.keyword = '▲ 超标';
vitamin_a._value.color = 'everyOrange';
}
//维生素E
vitamin_e._value.start = data.data.data.packAge[11].start_package;
vitamin_e._value.end = data.data.data.packAge[11].end_package;
vitamin_e._value.keyword = '✔ 正常';
vitamin_e._value.color = 'everyBlack';
if (vitamin_e._value.energy < vitamin_e._value.start) {
vitamin_e._value.keyword = '▼ 不足';
vitamin_e._value.color = 'everyRed';
} else if (vitamin_e._value.energy > vitamin_e._value.end) {
vitamin_e._value.keyword = '▲ 超标';
vitamin_e._value.color = 'everyOrange';
}
//维生素B1
vitamin_b1._value.start = data.data.data.packAge[12].start_package;
vitamin_b1._value.end = data.data.data.packAge[12].end_package;
vitamin_b1._value.keyword = '✔ 正常';
vitamin_b1._value.color = 'everyBlack';
if (vitamin_b1._value.energy < vitamin_b1._value.start) {
vitamin_b1._value.keyword = '▼ 不足';
vitamin_b1._value.color = 'everyRed';
} else if (vitamin_b1._value.energy > vitamin_b1._value.end) {
vitamin_b1._value.keyword = '▲ 超标';
vitamin_b1._value.color = 'everyOrange';
}
//维生素B2
vitamin_b2._value.start = data.data.data.packAge[13].start_package;
vitamin_b2._value.end = data.data.data.packAge[13].end_package;
vitamin_b2._value.keyword = '✔ 正常';
vitamin_b2._value.color = 'everyBlack';
if (vitamin_b2._value.energy < vitamin_b2._value.start) {
vitamin_b2._value.keyword = '▼ 不足';
vitamin_b2._value.color = 'everyRed';
} else if (vitamin_b2._value.energy > vitamin_b2._value.end) {
vitamin_b2._value.keyword = '▲ 超标';
vitamin_b2._value.color = 'everyOrange';
}
//维生素C
vitamin_c._value.start = data.data.data.packAge[14].start_package;
vitamin_c._value.end = data.data.data.packAge[14].end_package;
vitamin_c._value.keyword = '✔ 正常';
vitamin_c._value.color = 'everyBlack';
if (vitamin_c._value.energy < vitamin_c._value.start) {
vitamin_c._value.keyword = '▼ 不足';
vitamin_c._value.color = 'everyRed';
} else if (vitamin_c._value.energy > vitamin_c._value.end) {
vitamin_c
vitamin_c._value.keyword = '▲ 超标';
vitamin_c._value.color = 'everyOrange';
}
        
      });

    http.get('api/archives/viewreport?id=' + reportId.value + '&username=' + '' + '&guardian=' + '' + '&birth=' +'').then((res) => {
      
       data.value = res.data.data
      pagoda.value = res.data.data.pagoda;
      contents.value = res.data.data.contents;
      Diseaseanalysis.value = res.data.data.FoodDiseaseintervention;
      if (res.data.data.contents.water) {
        pagoda.value[0].product_energy = parseFloat(res.data.data.contents.water);
     }
      for(let i=0;i<res.data.data.diet.filter(item=>item.single.checkList=='早餐').length;i++){
        Breakfastenergy.value=Breakfastenergy.value+ Number(res.data.data.diet.filter(item=>item.single.checkList=='早餐')[i].energy)
        BreakfastList.value=res.data.data.diet.filter(item=>item.single.checkList=='早餐')
        BreakfastLists.value=res.data.data.diet.filter(item=>item.single.checkList=='早餐').length
      }
      for(let i=0;i<res.data.data.diet.filter(item=>item.single.checkList=='早加餐').length;i++){
        Morningenergy.value=Morningenergy.value+ Number(res.data.data.diet.filter(item=>item.single.checkList=='早加餐')[i].energy)
      }
      for(let i=0;i<res.data.data.diet.filter(item=>item.single.checkList=='午餐').length;i++){
        Lunchenergy.value=Lunchenergy.value+ Number(res.data.data.diet.filter(item=>item.single.checkList=='午餐')[i].energy)
        LunchList.value=res.data.data.diet.filter(item=>item.single.checkList=='午餐')
        LunchLists.value=res.data.data.diet.filter(item=>item.single.checkList=='午餐').length
      }
      for(let i=0;i<res.data.data.diet.filter(item=>item.single.checkList=='午加餐').length;i++){
        Noonenergy.value=Noonenergy.value+ Number(res.data.data.diet.filter(item=>item.single.checkList=='午加餐')[i].energy)
      }
      
      for(let i=0;i<res.data.data.diet.filter(item=>item.single.checkList=='晚餐').length;i++){
        Dinnerenergy.value=Dinnerenergy.value+ Number(res.data.data.diet.filter(item=>item.single.checkList=='晚餐')[i].energy)
        DinnerList.value=res.data.data.diet.filter(item=>item.single.checkList=='晚餐')
        DinnerLists.value=res.data.data.diet.filter(item=>item.single.checkList=='晚餐').length
      }
      for(let i=0;i<res.data.data.diet.filter(item=>item.single.checkList=='晚加餐').length;i++){
        Lateenergy.value=Lateenergy.value+ Number(res.data.data.diet.filter(item=>item.single.checkList=='晚加餐')[i].energy)
      }
      let color = ["#3EA4AA"];
    let color1 = ["#D0443B", "#3EA4AA"];
    let color2 = ["#D0443B", "#3EA4AA"];
    var arr = [];
    var arr2 = [];
    var parr = res.data.data.primaryHeight;
    if (res.data.data.primaryHeight) {
      for (let i = 0; i < parr.length; i++) {
        arr.push(parr[i].content);
        arr2.push(parr[i].month);
      }
    }

    //获取用户生日 用户出生到现在的月份
    const startDate = new Date(res.data.data.contents.birth);
    const endDate = new Date();
    let monthsDifference = (endDate.getMonth() + 1) - startDate.getMonth();
    if (endDate.getFullYear() > startDate.getFullYear()) {
      monthsDifference += 12 * (endDate.getFullYear() - startDate.getFullYear());
    }
    //获取月份对应的下标以及身高
    let months = monthsDifference;
    let result = arr2.indexOf(months);
    if (result !== -1) {
      Height_s.value = arr[result];
    } else {
      let results = arr2.findIndex(num => num > months);
      let ress = arr[results - 1];
      let ress1 = arr[results];
      Height_s.value = ((arr[results]) / 2) + ((arr[results - 1]) / 2);

    }


    var arr1 = [];
    var arr3 = [];
    var arr4 = [];
    var indexes = '';
    var parr1 = res.data.data.primaryWeight;

    if (res.data.data.primaryWeight) {
      for (let i = 0; i < parr1.length; i++) {
        arr1.push(parr1[i].content);
        arr3.push(parr1[i].month);
      }
    }


    arr4 = arr3.filter((item, index) => {
      return parseInt(item) > parseInt(res.data.data.sumbirths)
    })
    for (let i = 0; i < arr3.length; i++) {
      if (arr3[i] == arr4[0]) {
        indexes = i
      }
    }

    let result1 = arr3.indexOf(months);
    if (result1 !== -1) {
      Weight_s.value = arr1[result1];
    } else {
      let results1 = arr2.findIndex(num => num > months);
      Weight_s.value = Math.round(((arr1[results1]) / 2) + ((arr1[results1 - 1]) / 2));

    }



      // 能量
      if (letEnergy._value.energy < letEnergy.value.start) {
      principle.value = data.value.foodliving[2].content;
      energys.value = data.value.foodmotion[2].content;
      if (!FeedingRecommendations.value) {
        FeedingRecommendations.value = res.data.data.foodproposal.filter(item => { return item.proposal_type == 1 }).filter(item => { return item.up_type == 2 })[0].content.replace(/<.*?>/ig, "");
      }
      if (!NutritionRecommendations.value) {
        NutritionRecommendations.value = res.data.data.foodproposal.filter(item => { return item.proposal_type == 2 }).filter(item => { return item.up_type == 2 })[0].content.replace(/<.*?>/ig, "");
      }
      if (!DoctorRecommendations.value) {
        DoctorRecommendations.value = res.data.data.foodproposal.filter(item => { return item.proposal_type == 3 }).filter(item => { return item.up_type == 2 })[0].content.replace(/<.*?>/ig, "");
      }
      letEnergy._value.keyword = '▼ 不足';
      letEnergy._value.color = 'everyRed';
      kcalType.value = 3
    } else if (letEnergy._value.energy > letEnergy.value.end) {
      principle.value = data.value.foodliving[1].content;
      energys.value = data.value.foodmotion[0].content;
      if (!FeedingRecommendations.value) {
        FeedingRecommendations.value = res.data.data.foodproposal.filter(item => { return item.proposal_type == 1 }).filter(item => { return item.up_type == 1 })[0].content.replace(/<.*?>/ig, "");
      }
      if (!NutritionRecommendations.value) {
        NutritionRecommendations.value = res.data.data.foodproposal.filter(item => { return item.proposal_type == 2 }).filter(item => { return item.up_type == 1 })[0].content.replace(/<.*?>/ig, "");
      }
      if (!DoctorRecommendations.value) {
        DoctorRecommendations.value = res.data.data.foodproposal.filter(item => { return item.proposal_type == 3 }).filter(item => { return item.up_type == 1 })[0].content.replace(/<.*?>/ig, "");
      }
      letEnergy._value.keyword = '▲ 超标';
      letEnergy._value.color = 'everyOrange';
      kcalType.value = 1
    } else {
      principle.value = data.value.foodliving[0].content;
      energys.value = data.value.foodmotion[1].content;
      if (!FeedingRecommendations.value) {
        FeedingRecommendations.value = res.data.data.foodproposal.filter(item => { return item.proposal_type == 1 }).filter(item => { return item.up_type == 3 })[0].content.replace(/<.*?>/ig, "");
      }
      if (!NutritionRecommendations.value) {
        NutritionRecommendations.value = res.data.data.foodproposal.filter(item => { return item.proposal_type == 2 }).filter(item => { return item.up_type == 3 })[0].content.replace(/<.*?>/ig, "");
      }
      if (!DoctorRecommendations.value) {
        DoctorRecommendations.value = res.data.data.foodproposal.filter(item => { return item.proposal_type == 3 }).filter(item => { return item.up_type == 3 })[0].content.replace(/<.*?>/ig, "");
      }
    }
    //  蛋白质
    if (protein._value.energy < protein._value.start) {
      proteins.value = data.value.foodmotion[5].content;
      protein._value.keyword = '▼ 不足';
      protein._value.color = 'everyRed';
    } else if (protein._value.energy > protein._value.end) {
      proteins.value = data.value.foodmotion[3].content;
      protein._value.keyword = '▲ 超标';
      protein._value.color = 'everyOrange';
    } else {
      proteins.value = data.value.foodmotion[4].content;
    }
    //脂肪
    if (fat._value.energy < fat._value.start) {
      fats.value = data.value.foodmotion[8].content;
      fat._value.keyword = '▼ 不足';
      fat._value.color = 'everyRed';
    } else if (fat._value.energy > fat._value.end) {
      fats.value = data.value.foodmotion[6].content;
      fat._value.keyword = '▲ 超标';
      fat._value.color = 'everyOrange';
    } else {
      fats.value = data.value.foodmotion[7].content;
    }
    //碳水化合物
    if (carbohydrate._value.energy < carbohydrate._value.start) {
      carbohydrates.value = data.value.foodmotion[11].content;
      carbohydrate._value.keyword = '▼ 不足';
      carbohydrate._value.color = 'everyRed';
    } else if (carbohydrate._value.energy > carbohydrate._value.end) {
      carbohydrates.value = data.value.foodmotion[9].content;
      carbohydrate._value.keyword = '▲ 超标';
      carbohydrate._value.color = 'everyOrange';
    } else {
      carbohydrates.value = data.value.foodmotion[10].content;
    }
    //钙
    if (calcium._value.energy < calcium._value.start) {
      calciums.value = data.value.foodmotion[14].content;
      calcium._value.keyword = '▼ 不足';
      calcium._value.color = 'everyRed';
    } else if (calcium._value.energy > calcium._value.end) {
      calciums.value = data.value.foodmotion[12].content;
      calcium._value.keyword = '▲ 超标';
      calcium._value.color = 'everyOrange';
    } else {
      calciums.value = data.value.foodmotion[13].content;
    }
    //钠
    if (sodium._value.energy < sodium._value.start) {
      sodiums.value = data.value.foodmotion[17].content;
      sodium._value.keyword = '▼ 不足';
      sodium._value.color = 'everyRed';
    } else if (sodium._value.energy > sodium._value.end) {
      sodiums.value = data.value.foodmotion[15].content;
      sodium._value.keyword = '▲ 超标';
      sodium._value.color = 'everyOrange';
    } else {
      sodiums.value = data.value.foodmotion[16].content;
    }
    //镁
    if (magnesium._value.energy < magnesium._value.start) {
      magnesiums.value = data.value.foodmotion[20].content;
      magnesium._value.keyword = '▼ 不足';
      magnesium._value.color = 'everyRed';
    } else if (magnesium._value.energy > magnesium._value.end) {
      magnesiums.value = data.value.foodmotion[18].content;
      magnesium._value.keyword = '▲ 超标';
      magnesium._value.color = 'everyOrange';
    } else {
      magnesiums.value = data.value.foodmotion[19].content;
    }
    //铁
    if (iron._value.energy < iron._value.start) {
      irons.value = data.value.foodmotion[23].content;
      iron._value.keyword = '▼ 不足';
      iron._value.color = 'everyRed';
    } else if (iron._value.energy > iron._value.end) {
      irons.value = data.value.foodmotion[21].content;
      iron._value.keyword = '▲ 超标';
      iron._value.color = 'everyOrange';
    } else {
      irons.value = data.value.foodmotion[22].content;
    }
    //锌
    if (zinc._value.energy < zinc._value.start) {
      zincs.value = data.value.foodmotion[26].content;
      zinc._value.keyword = '▼ 不足';
      zinc._value.color = 'everyRed';
    } else if (zinc._value.energy > zinc._value.end) {
      zincs.value = data.value.foodmotion[24].content;
      zinc._value.keyword = '▲ 超标';
      zinc._value.color = 'everyOrange';
    } else {
      zincs.value = data.value.foodmotion[25].content;
    }
    //硒
    if (selenium._value.energy < selenium._value.start) {
      seleniums.value = data.value.foodmotion[29].content;
      selenium._value.keyword = '▼ 不足';
      selenium._value.color = 'everyRed';
    } else if (selenium._value.energy > selenium._value.end) {
      seleniums.value = data.value.foodmotion[27].content;
      selenium._value.keyword = '▲ 超标';
      selenium._value.color = 'everyOrange';
    } else {
      seleniums.value = data.value.foodmotion[28].content;
    }
    //维生素A
    if (vitamin_a._value.energy < vitamin_a._value.start) {
      vitamin_as.value = data.value.foodmotion[32].content;
      vitamin_a._value.keyword = '▼ 不足';
      vitamin_a._value.color = 'everyRed';
    } else if (vitamin_a._value.energy > vitamin_a._value.end) {
      vitamin_as.value = data.value.foodmotion[30].content;
      vitamin_a._value.keyword = '▲ 超标';
      vitamin_a._value.color = 'everyOrange';
    } else {
      vitamin_as.value = data.value.foodmotion[31].content;
    }
    //维生素E
    if (vitamin_e._value.energy < vitamin_e._value.start) {
      vitamin_es.value = data.value.foodmotion[35].content;
      vitamin_e._value.keyword = '▼ 不足';
      vitamin_e._value.color = 'everyRed';
    } else if (vitamin_e._value.energy > vitamin_e._value.end) {
      vitamin_es.value = data.value.foodmotion[33].content;
      vitamin_e._value.keyword = '▲ 超标';
      vitamin_e._value.color = 'everyOrange';
    } else {
      vitamin_es.value = data.value.foodmotion[34].content;
    }
    //维生素B1
    if (vitamin_b1._value.energy < vitamin_b1._value.start) {
      vitamin_b1s.value = data.value.foodmotion[38].content;
      vitamin_b1._value.keyword = '▼ 不足';
      vitamin_b1._value.color = 'everyRed';
    } else if (vitamin_b1._value.energy > vitamin_b1._value.end) {
      vitamin_b1s.value = data.value.foodmotion[36].content;
      vitamin_b1._value.keyword = '▲ 超标';
      vitamin_b1._value.color = 'everyOrange';
    } else {
      vitamin_b1s.value = data.value.foodmotion[37].content;
    }
    //维生素B2
    if (vitamin_b2._value.energy < vitamin_b2._value.start) {
      vitamin_b2s.value = data.value.foodmotion[41].content;
      vitamin_b2._value.keyword = '▼ 不足';
      vitamin_b2._value.color = 'everyRed';
    } else if (vitamin_b2._value.energy > vitamin_b2._value.end) {
      vitamin_b2s.value = data.value.foodmotion[39].content;
      vitamin_b2._value.keyword = '▲ 超标';
      vitamin_b2._value.color = 'everyOrange';
    } else {
      vitamin_b2s.value = data.value.foodmotion[40].content;
    }
    //维生素C
    if (vitamin_c._value.energy < vitamin_c._value.start) {
      vitamin_cs.value = data.value.foodmotion[44].content;
      vitamin_c._value.keyword = '▼ 不足';
      vitamin_c._value.color = 'everyRed';
    } else if (vitamin_c._value.energy > vitamin_c._value.end) {
      vitamin_cs.value = data.value.foodmotion[42].content;
      vitamin_c._value.keyword = '▲ 超标';
      vitamin_c._value.color = 'everyOrange';
    } else {
      vitamin_cs.value = data.value.foodmotion[43].content;
    }
  

    })
  
  
    if (route.params.groupId) {
      groupId.value = route.params.groupId
      id.value = route.params.id
      reportId.value = route.params.reportId
      if (groupId.value == 3) {
        labName.value = '婴幼儿营养测评'
      } else if (groupId.value == 5) {
        labName.value = '孕产妇营养测评'
      } else if (groupId.value == 6) {
        labName.value = '成年人营养测评'
      } else if (groupId.value == 7) {
        labName.value = '慢性病营养测评'
      } else if (groupId.value == 8) {
        labName.value = '团体营养测评'
      }
      //获取个人信息
      http.get('api/archives/evaluating?id=' + id.value).then((res) => {
        userinfo.value = res.data.data;
      })
      
     
      setTimeout(() => {
          print("#pdfDom1");
        }, 3000);
    } else {
      ElMessage.error('栏目编号不得为空')
      await router.push({ 'path': '/Home' })
    }
     
  }
  
  onMounted(() => {
    fetchData()
  })
  </script>
<style scoped>
  .biao1 {
    width: 25%;
    border-bottom: 1px solid rgb(9, 165, 120);
    border-right: 1px solid rgb(9, 165, 120);
    background-color: rgb(42, 178, 139);
    color: #fff;
  }
  
  .biao5 {
    width: 25%;
    border-right: 1px solid rgb(9, 165, 120);
    background-color: rgb(42, 178, 139);
    color: #fff;
  }
  
  .biao6 {
    width: 25%;
    border-right: 1px solid rgb(9, 165, 120);
    color: #000;
  }
  
  .biao2 {
    width: 25%;
    border-bottom: 1px solid rgb(9, 165, 120);
    border-right: 1px solid rgb(9, 165, 120);
    color: #000;
  }
  
  .biao3 {
    width: 25%;
    border-bottom: 1px solid rgb(9, 165, 120);
    background-color: rgb(42, 178, 139);
    color: #fff;
  }
  
  .biao4 {
    width: 75%;
    border-bottom: 1px solid rgb(9, 165, 120);
    color: #000;
  }
  
  .biao7 {
    /* border-right: 1px solid rgb(9, 165, 120);
    border-bottom: 1px solid rgb(9, 165, 120); */
    border: 1px solid rgb(9, 165, 120);
  }
  
  #proposal {
    width: 1075px;
    height: 456px;
    background: url(".././assets/img/report_proposal.png");
  }
  
  /deep/ #elTextThree {
    width: 100%;
  }
  
  /deep/.el-textarea__inner {
    width: 946px;
    height: 157px;
    border-radius: 30px;
    border: 1px solid #2ab28b;
  }
  
  /deep/.el-textarea__inner .red {
    width: 946px;
    height: 157px;
    border-radius: 30px;
    border: 1px solid #2ab28b;
  }
  
  #elTextTwo {
    background: #2ab28b;
  }
  
  /deep/.el-textarea {
    width: 80%;
    margin-left: 70px;
  }
  
  .params {
    width: 100%;
    font-size: 22px;
    font-weight: bold;
  }
  
  .shu {
    width: 5px;
    height: 30px;
    background: #2ab28b;
    opacity: 1;
    border-radius: 100px;
    float: left;
    margin-right: 2%;
    margin-left: 5%;
  }
  
  .shured {
    width: 5px;
    height: 30px;
    background: red;
    opacity: 1;
    border-radius: 100px;
    float: left;
    margin-right: 2%;
    margin-left: 5%;
  }
  
  .right-box-card {
    width: 100%;
    margin-left: 0%;
  }
  
  .el-card.is-always-shadow {
    box-shadow: none;
  }
  
  .el-card {
    border: none;
  }
  
  .report {
    /*width: 595px;*/
    /*height: 842px;*/
  }
  
  .titles {
    margin-right: 20px;
  }
  
  #basic .title {
    font-size: 36px;
    width: 100%;
    text-align: center;
    height: 100px;
    margin-top: 100px;
  }
  
  #basic #createTime {
    font-size: 16px;
    color: #999999;
    margin-left: 70%;
  }
  
  .subTitle {
    font-size: 30px;
    text-align: center;
    height: 30px;
    color: #2ab28b;
    /*border-bottom: 1px dashed  red;*/
  }
  
  #two {
    width: 1075px;
    height: 1244px;
    border-left: 1px #999999 solid;
    border-right: 1px #999999 solid;
    margin: 0 auto 0 auto;
  }
  
  #basic {
    font-size: 16px;
    width: 1075px;
    min-height: 1244px;
    overflow: hidden;
    padding: 0;
    word-break: break-all;
    /*margin: 60px auto 0 auto;*/
    box-shadow: var(--el-box-shadow-light);
    border-radius: var(--el-card-border-radius);
    background-color: var(--el-card-bg-color);
    /* color: var(--el-text-color-primary); */
    transition: var(--el-transition-duration);
    --el-card-border-color: var(--el-border-color-light, #ebeef5);
    --el-card-border-radius: 4px;
    --el-card-padding: 20px;
    --el-card-bg-color: var(--el-color-white);
  }
  
  #basic .symptom_title {
    font-size: 20px;
    margin-top: 30px;
  }
  
  .every {
    height: 55px;
    line-height: 55px;
    width: 23%;
    float: left;
    margin-left: 10%;
    font-weight: bold;
  }
  
  #basic .symptom {
    text-align: left;
    line-height: 35px;
  }
  
  #basic .symptom .every {
    width: 30%;
    float: left;
    margin-left: 2%;
  }
  
  .symptom_content {
    width: 100%;
    float: left;
    margin-left: 120px;
  }
  
  .service_plate {
    background: url(".././assets/img/evaluaction_service_plate.png") center no-repeat;
  }
  
  .dietOn {
    width: 100%;
    /* height: 510px; */
    /* margin-top:90px; */
    /* margin-top:150px; */
    padding-top: 20px;
    /* padding-bottom: 60px; */
  }
  
  .everyRed {
    color: red;
  }
  
  .everyOrange {
    color: orange;
  }
  
  .everyBlack {
    color: #333333;
  }
  
  .time-botton {
    background-color: #2ab28b;
    width: 108px;
    height: 41px;
    color: #fff;
    font-size: 16px;
    border-radius: 100px;
    line-height: 41px;
    margin: 42px 0 0 40px;
    text-align: center;
  }
  
  .time-type {
    width: 58px;
    height: 58px;
    line-height: 58px;
    text-align: center;
    background: #85ce61;
    border-radius: 50%;
    opacity: 1;
    color: #fff;
    box-shadow: 5px 5px 2px #888888;
    margin: 20px 0 20px 40%;
  }
  
  .der {
    width: 240px;
    height: 174px;
    background: url(".././assets/img/evaluaction_service_plate.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    margin: auto;
  }
  
  .platesFoods {
    margin-top: 5px;
    margin-left: 8px;
    color: #333333;
    font-size: 14px;
    text-align: center;
  }
  
  .platesFoods div {
    padding-bottom: 5px;
  }
  
  .platesFoods span {
    color: #666666;
  }
  
  .plates {
    width: 33%;
    float: left;
  }
  
  .plates .plates-top-img {
    float: left;
    margin-left: 1%;
    width: 30%;
  }
  
  .time-left-color {
    background: #85ce61;
  }
  
  .time-common-color {
    background: #e8b973;
  }
  
  .time-right-color {
    background: #6ea9e0;
  }
  </style>
        
    